﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using BI.CF.Model;
using BI.CF.BLL;
using BI.CF.Common;
using System.Web.Caching;
using System.Web.SessionState;

namespace BackStage.Hand
{
    /// <summary>
    /// AdminLogin 的摘要说明
    /// </summary>
    public class AdminLogin : IHttpHandler, IRequiresSessionState
    {
        Admin_bll bll = new Admin_bll();
        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "text/plain";
            if (context.Request["GetType"].ToString()=="login")
            {
                string Name = context.Request["name"].ToString();
                string Pwd = context.Request["pwd"].ToString();
                BackAdminModel Bmodel= bll.Admin_Login(Name,Pwd);
                SessionHelper.SetSession("Bmodel",Bmodel);
                BackAdminModel Bmode = new BackAdminModel();
                Bmode = SessionHelper.GetSession("Bmodel") as BackAdminModel;
                if (Bmodel!=null)
                {
                    context.Response.Write(1);
                }
                else
                {
                    context.Response.Write(0);  
                }
                
            }
            
           
        }

        public bool IsReusable
        {
            get
            {
                return false;
            }
        }
    }
}